﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Coding4Fun.Toolkit.Controls">

	<Style TargetType="local:ColorPicker">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="local:ColorPicker">
					<Grid>
						<VisualStateManager.VisualStateGroups>
							<VisualStateGroup x:Name="CommonStates">
								<VisualState x:Name="Normal" />
								<VisualState x:Name="Disabled">
									<Storyboard>
										<ObjectAnimationUsingKeyFrames
                                            Storyboard.TargetProperty="Opacity" 
											Storyboard.TargetName="SelectedHueColor">
											<DiscreteObjectKeyFrame KeyTime="0" Value="0"/>
										</ObjectAnimationUsingKeyFrames>
										<ObjectAnimationUsingKeyFrames
                                            Storyboard.TargetProperty="Opacity" 
											Storyboard.TargetName="SampleSelector">
											<DiscreteObjectKeyFrame KeyTime="0" Value="0"/>
										</ObjectAnimationUsingKeyFrames>
										<ObjectAnimationUsingKeyFrames
                                            Storyboard.TargetProperty="Fill" 
											Storyboard.TargetName="SelectedColor">
											<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource DefaultDisabledBrush}"/>
										</ObjectAnimationUsingKeyFrames>

									</Storyboard>
								</VisualState>
							</VisualStateGroup>
						</VisualStateManager.VisualStateGroups>
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="Auto" />
							<ColumnDefinition Width="*" />
						</Grid.ColumnDefinitions>
						<Grid.RowDefinitions>
							<RowDefinition Height="Auto" />
							<RowDefinition Height="*" />
						</Grid.RowDefinitions>

						<Rectangle 
                            Margin="0,0,0,12"
                            Height="24"
			                Grid.Row="0"
                            Grid.ColumnSpan="2"
							Name="SelectedColor"
			                Fill="{TemplateBinding SolidColorBrush}" />

						<local:ColorSlider 
                            Width="24"
                            Margin="0,0,12,0"
                            IsColorVisible="false" 
                            Thumb="{TemplateBinding Thumb}"
                            x:Name="ColorSlider" 
                            Grid.Row="2"/>

						<Grid 
                            Name="Body"
			                Grid.Column="1"
			                Grid.Row="1">
							<Rectangle 
                                Name="SelectedHueColor" 
                                Fill="Red" />
							<Rectangle>
								<Rectangle.Fill>
									<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
										<GradientStop Offset="0" Color="White"/>
										<GradientStop Offset="1" Color="Transparent"/>
									</LinearGradientBrush>
								</Rectangle.Fill>
							</Rectangle>
							<Rectangle>
								<Rectangle.Fill>
									<LinearGradientBrush StartPoint="0,1" EndPoint="0, 0">
										<GradientStop Offset="0" Color="Black"/>
										<GradientStop Offset="1" Color="Transparent"/>
									</LinearGradientBrush>
								</Rectangle.Fill>
							</Rectangle>
							<Grid 
                                Name="SampleSelector"
                                VerticalAlignment="Top" 
                                HorizontalAlignment="Left">
								<Ellipse
                                    Height="22"
                                    Width="22"
                                    StrokeThickness="5" 
                                    Stroke="Black" />
								<Ellipse 
                                    Height="24"
                                    Width="24"
                                    StrokeThickness="3" 
                                    Stroke="White" />
							</Grid>
						</Grid>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>